package com.lm.activiti.boot.datatype;

import com.alibaba.fastjson.JSON;
import com.google.common.collect.Maps;
import com.google.common.collect.Table;
import com.google.common.collect.TreeBasedTable;
import org.junit.Test;

import java.util.Hashtable;
import java.util.Map;

/**
 * @author lm_jcf
 * @date 2019/12/25 10:15
 */
public class TablesTest {

    public static void main(String[] args) {

        Table<String, Integer, String> table = TreeBasedTable.create();

        table.put("3", 1, "33");
        table.put("1", 1, "1");
        table.put("2", 2, "2");
        table.put("2", 2, "2");

        System.out.println(JSON.toJSONString(table.values()));

        System.out.println(table.values());

        System.out.println(table.get("1", 2));

        for (String rowKey : table.rowKeySet()) {
            Map<Integer, String> row = table.row(rowKey);

            System.out.println(row);
        }

        for (Integer columnKey : table.columnKeySet()) {
            System.out.println(columnKey);
            Map<String, String> column = table.column(columnKey);
            System.out.println(column);
        }

        System.out.println(table.get("44", 33));

        Map<Integer, String> map = Maps.newLinkedHashMap();
        map.put(33, "33");
        map.put(333, "333");

    }

    @Test
    public void hashTableTest() {

        Hashtable hashtable = new Hashtable();

        hashtable.put("de", "de");
        System.out.println(hashtable);

        Integer integer = new Integer(2000);
        System.out.println(integer.equals(new Integer(2000)));

    }

    @Test
    public void switchTest(){
        switch (6){
            case 1:
                System.out.println("1");
            case 2:
                System.out.println("2");

            case 3:
                System.out.println("3");
                break;
            case 4:
                System.out.println("4");
                break;
                default:
                    System.out.println("default");
        }
    }

}
